import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    token: localStorage.getItem('hmmjdemo96') || ''
  },

  mutations: {
    setToken (state, token) {
      // 存到state
      state.token = token
      // 存到localStorage
      localStorage.setItem('hmmjdemo96', token)
    }
  }
})
